package main

import "fmt"

func searchRange(nums []int, target int) []int {
	l := lowBound(nums, target)
	if l == len(nums) || nums[l] != target {
		return []int{-1, -1}
	}
	return []int{l, lowBound(nums, target+1) - 1}
}

func lowBound(nums []int, target int) int {
	l, r := 0, len(nums)
	for l < r {
		mid := (l + r) / 2
		if nums[mid] >= target {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}
func main() {
	nums := []int{5, 7, 7, 8, 8, 10}
	target := 8
	fmt.Println(searchRange(nums, target))
}
